home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / util / rexx / rmh.lha / rmh / examples / clips.rexx < prev    next >
OS/2 REXX Batch file  |  1999-04-23  |  737b  |  41 lines

  1. /*
  2. Show the use of the pattern functions
  3. Usage clips [FILTER]
  4. FILTER an AmigaDOS pattern
  5. */
  6.  
  7. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  8. prg=ProgramName("NOEXT")
  9.  
  10. parm.0.value="#?"
  11. if ~RMH_ReadArgs("FILTER") then do
  12.     call PrintFault(IoErr(),prg)
  13.     exit
  14. end
  15.  
  16. f=ParsePattern(parm.0.value)
  17. clips=show('C',,'A'x)
  18. i=0
  19. do j=0 while clips~=""
  20.     parse var clips clip 'A'x clips
  21.     if MatchPattern(f,clip) then do
  22.         cont=GetClip(clip)
  23.         list.i=left(clip,20)" "left(GetClip(clip),20)
  24.         if length(cont)>20 then list.i=list.i"..."
  25.         i=i+1
  26.     end
  27. end
  28.  
  29. if j=0 then do
  30.     say "ARexx clips list is empty"
  31.     exit
  32. end
  33. say "Total clips:   " j
  34. say "Filtered clips:" i
  35. if i>0 then do
  36.     say "---------------"
  37.     do n=0 to i-1
  38.         say list.n
  39.     end
  40. end
  41.